<!DOCTYPE html>
<html lang="en">
<head>
  <meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no,width=device-width,height=device-height">
  <meta charset="UTF-8">
  <meta name="Author" content="haley">
  <meta name="Keywords" content="前端最常用的UI插件">
  <meta name="Description" content="最常用的UI插件">
  <script crossorigin="anonymous" integrity="sha384-6ePHh72Rl3hKio4HiJ841psfsRJveeS+aLoaEf3BWfS+gTF0XdAqku2ka8VddikM" src="https://lib.baomitu.com/jquery/1.11.3/jquery.min.js"></script>
  <link crossorigin="anonymous" integrity="sha384-pdapHxIh7EYuwy6K7iE41uXVxGCXY0sAjBzaElYGJUrzwodck3Lx6IE2lA0rFREo" href="https://lib.baomitu.com/twitter-bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet">
  <link href="../../css/page.css" rel="stylesheet">
  <script crossorigin="anonymous" integrity="sha384-pPttEvTHTuUJ9L2kCoMnNqCRcaMPMVMsWVO+RLaaaYDmfSP5//dP6eKRusbPcqhZ" src="https://lib.baomitu.com/twitter-bootstrap/3.3.5/js/bootstrap.min.js"></script>
  <script crossorigin="anonymous" integrity="sha384-8t+aLluUVnn5SPPG/NbeZCH6TWIvaXIm/gDbutRvtEeElzxxWaZN+G/ZIEdI/f+y" src="https://lib.baomitu.com/vue/2.6.10/vue.min.js"></script>
  <script src="../../js/page.js"></script>
  <script src="../../js/changeTitle.js"></script>
  <link href="../../imgs/favicon.ico" rel="shortcut icon">
  <script src="../../js/goToHome.js"></script>
  <title></title>
  <script>
    var data={
      title:'Tab选项卡',
      content:{
        intro:{
          list:[
            {
              title:'使用说明：',
              className:'bs-callout-info',
              list:[
                {title:'基础配置：',content:'jq'}
                ,{title:'需要的代码：',content:'style里面的代码+核心html部分代码+核心js代码'}
                ,{title:'如何使用：',content:'直接查看本文件源码'}
              ]
            }
            ,{
              title:'实现原理：',
              className:'bs-callout-warning',
              list:[
                {
                  title:'',
                  content:'点击tabs下面的tab，获取tab当前所处index，在panes里寻找与之对应的pane进行显示，同时隐藏其他的pane'
                }
              ]
            }
          ]
        }
      }
    };
  </script>
  <style>
    ul,li,ol{padding:0;margin:0;list-style: none; }
    .tabPanel{
      border:1px solid #bce8f1;
      width: 100%;
      float: left;
      margin-right: 20px;
      padding:20px;
    }
    .tabPanel>.tabs{
      text-align: center;
      overflow: hidden;
    }

    .tabPanel>.tabs>.tab{
      height:60px;
      line-height: 60px;
      cursor: pointer;
      float: left;
      color: #7C7C7C;
      font-size: 20px;
      width:20%;
      border-bottom: 2px solid transparent;
    }
    .tabPanel>.tabs>.tab.hit{
      color:#E2393E;
      border-color:#E2393E;
    }
    .panes>.pane{
      display: none;
      width: 100%;
      min-height: 220px;
    }
    .panes>.pane.show{
      display: block;
    }
  </style>
</head>
<body>
<div id="page">
  <div class="container">
    <h3 class="text-center">{{title}}</h3>
    <div class="bs-callout" :class="item.className" v-for="item in content.intro.list">
      <h4>{{item.title}}</h4>
      <ul>
        <li v-for="item2 in item.list"><b>{{item2.title}}</b>{{item2.content}}</li>
      </ul>
    </div>
  </div>
  <script>
    var page = new Vue({
      el: '#page',
      data: data
    });
  </script>
</div>

<div class="container">
  <section class="panel panel-info">
    <div class="panel-heading">横向切换选项卡</div>
    <div class="panel-body">
      <div class="row">
        <div class="col-sm-6">
          <!--核心html代码 s-->
          <section class="tabPanel">
            <ul class="tabs">
              <li class="tab hit">Tab1</li>
              <li class="tab">Tab2</li>
              <li class="tab">Tab3</li>
            </ul>
            <ol class="panes">
              <li class="pane show" >
                <p>First tab content</p>
                <p>First tab content</p>
                <p>First tab content</p>
                <p>First tab content</p>
              </li>
              <li class="pane" >
                <h4>Secend tab content</h4><p>Secend tab content</p>
              </li>
              <li class="pane" >
                <h4>Third tab content</h4><p>Third tab content</p>
              </li>
            </ol>
          </section>
          <!--核心html代码 e-->
          </div>
          <div class="col-md-6">
            <!--核心html代码 s-->
            <section class="tabPanel">
              <ul class="tabs">
                <li class="tab hit">Tab1</li>
                <li class="tab">Tab2</li>
                <li class="tab">Tab3</li>
              </ul>
              <ol class="panes">
                <li class="pane show" >
                  <p>First tab content</p>
                  <p>First tab content</p>
                  <p>First tab content</p>
                </li>
                <li class="pane" >
                  <h4>Secend tab content</h4><p>Secend tab content</p>
                </li>
                <li class="pane" >
                  <h4>Third tab content</h4><p>Third tab content</p>
                </li>
              </ol>
            </section>
            <!--核心html代码 e-->
          </div>
      </div>
      <script type="text/javascript">
        /**
         * 核心切换js代码
         */
        $(function(){
          $('.tabPanel ul li').click(function(){
            $(this).addClass('hit').siblings().removeClass('hit');
            $(this).parent('.tabs').siblings('.panes').children('').eq($(this).index()).addClass('show').siblings().removeClass('show');
          });
        })
      </script>
    </div>
  </section>
</div>

</body>
</html>
